package com.eshopkeeper.core.support.ldap;


import org.springframework.ldap.core.AttributesMapper;

import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;


/**
 * ClassName: ErrorInfoAttributesMapper
 * @Description: ldap属性匹配实体
 * @author chenshufeng
 * @date 2017-2-9
 */
public class SystemSettingAttributesMapper implements AttributesMapper<SystemSetting> {

	@Override
	public SystemSetting mapFromAttributes(Attributes attributes)
			throws NamingException {
		SystemSetting setting = new SystemSetting();
        Attribute systemSettingCommet = attributes.get("systemSettingCommet");
        Attribute systemSettingHtmlInfo = attributes.get("systemSettingHtmlInfo");
        Attribute systemSettingName = attributes.get("systemSettingName");
        Attribute systemSettingValue = attributes.get("systemSettingValue");

        setting.setSystemSettingCommet(String.valueOf(String.valueOf(systemSettingCommet).replace("systemSettingCommet: ","")));
        setting.setSystemSettingHtmlInfo(String.valueOf(String.valueOf(systemSettingHtmlInfo).replace("systemSettingHtmlInfo: ","")));
        setting.setSystemSettingName(String.valueOf(String.valueOf(systemSettingName).replace("systemSettingName: ","")));
        setting.setSystemSettingValue(String.valueOf(String.valueOf(systemSettingValue).replace("systemSettingValue: ","")));

        return setting;
	}

}